package relatorios.presenter;

import br.com.webhomesites.padrao.utils.Mascarador;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;

public class RelatoriosPresenterActionListener {

    static class EmitirRelLocPorCliListener implements ActionListener{

        private RelatoriosPresenter relatoriosPresenter;

        public EmitirRelLocPorCliListener(RelatoriosPresenter relatoriosPresenter) {
            this.relatoriosPresenter = relatoriosPresenter;
        }

        @Override
        public void actionPerformed(ActionEvent evt) {
            relatoriosPresenter.setOperacao(relatoriosPresenter.REL_LOC_POR_CLI_STRATEGY);
            relatoriosPresenter.getOperacao().execute();
            relatoriosPresenter.getRelLocPorCliView().dispose();
        }

    }
    
    static class CampoKeyListener implements KeyListener {

        private RelatoriosPresenter presenter;
        Mascarador mask;

        public CampoKeyListener(RelatoriosPresenter presenter) {
            this.presenter = presenter;
            mask = new Mascarador();
        }

        @Override
        public void keyTyped(KeyEvent e) {
            
        }

        @Override
        public void keyPressed(KeyEvent e) {
            
        }

        @Override
        public void keyReleased(KeyEvent e) {
            presenter.getRelLocPorCliView().setDataInicial(mask.getMascara(presenter.getRelLocPorCliView().getDataInicial(), mask.DATA, e));
            presenter.getRelLocPorCliView().setDataFinal(mask.getMascara(presenter.getRelLocPorCliView().getDataFinal(), mask.DATA, e));
        }    
    }
}
